package sample.retrofit

import java.util

import retrofit.client.Response
import retrofit.{RetrofitError, Callback, RestAdapter}
import retrofit.RestAdapter.Builder
import sample.Person

/**
 * Created on 2015/6/21.
 *
 * @author Misty
 */
object TestJavaApi extends App {
    val adapter = new Builder().setEndpoint("http://localhost:3000/api")
      .setLogLevel(RestAdapter.LogLevel.FULL)
      .build()
    val api = adapter.create(classOf[JavaApi])

    api.listAll(new Callback[util.List[Person]] {
        override def failure(error: RetrofitError): Unit = ???

        override def success(t: util.List[Person], response: Response): Unit = {
            println(t)
        }
    })
}
